-- get lualine nightfly theme
-- local lualine_nightfly = require("lualine.themes.nightfly")

-- new colors for theme
local new_colors = {
    blue = "#65D1FF",
    green = "#3EFFDC",
    violet = "#FF61EF",
    yellow = "#FFDA7B",
    black = "#000000",
}

-- change nightlfy theme colors
-- lualine_nightfly.normal.a.bg = new_colors.blue
-- lualine_nightfly.insert.a.bg = new_colors.green
-- lualine_nightfly.visual.a.bg = new_colors.violet
-- lualine_nightfly.command = {
--     a = {
--         gui = "bold",
--         bg = new_colors.yellow,
--         fg = new_colors.black, -- black
--     },
-- }

return {
    {
        "nvim-lualine/lualine.nvim",
        dependencies = {
            'sainnhe/gruvbox-material',
            'RRethy/nvim-base16',
        },
        requires = { "nvim-tree/nvim-web-devicons", opt = true },

        config = function()
            require("lualine").setup({
                options = {
                    icons_enabled = true,
                    -- theme = "gruvbox-material",
                    -- theme = "base16",
                    theme = "tokyonight",
                    component_separators = { left = "", right = "" },
                    -- section_separators = { left = '', right = ''},
                    -- component_separators = { left = "|", right = "|" },
                    section_separators = { left = " ", right = "" },
                    disabled_filetypes = {
                        statusline = {},
                        winbar = {},
                    },
                    ignore_focus = {},
                    always_divide_middle = true,
                    globalstatus = false,
                    -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
                    --     -- remove extension from markdown files for example
                    --     if buf.name:match("%.md") then
                    --         return vim.fn.fnamemodify(buf.name, ":t:r")
                    --     end
                    -- end,
                    max_name_length = 15,
                    max_prefix_length = 12, -- prefix used when a buffer is de-duplicated
                    tab_size = 15,
                    diagnostics = "nvim_lsp",
                    diagnostics_update_in_insert = false,
                    refresh = {
                        statusline = 1000,
                        tabline = 1000,
                        winbar = 1000,
                    },
                },
                extensions = { "nvim-tree", "toggleterm" },
                sections = {
                    lualine_a = { "mode" },
                    lualine_b = { "branch", "diff" },
                    lualine_c = { "filename", {"lsp_progress"}, },
                    lualine_x = {
                        "encoding",
                        "fileformat",
                        "filetype",
                    },
                    lualine_y = { "progress" },
                    lualine_z = { "location" },
                },
            })
        end,
    },
}
